home *** CD-ROM | disk | FTP | other *** search
- /*
- * Source - CShape.c
- * Author - Mark Bykerk Kauffman
- * Purpose - This file contains the implementaion of the methods
- * defined the by shape classes in CShape.h
- */
-
- #include "CShape.h"
- #include "Quickdraw.h"
-
- void CShape :: Draw(void)
- {
- }
-
- void CShape :: Erase(void)
- {
- }
-
- void CShape :: SetShapeLoc(Left,Top,Right,Bottom)
- int Left;
- int Top;
- int Right;
- int Bottom;
- {
- Rect Location;
- /* LOCAL location variable */
-
- SetRect(&Location,Left,Top,Right,Bottom);
- this->Location = Location;
- /*
- * Set the instance variable Location to
- * the local Location value. The
- * reason for doing this is that Semantec
- * states in the TNINK C manual
- * "Your program should not rely on the
- * addresses of instance variables...".
- * Semantec describes the above technique as
- * "shadowing".
- */
- }
-
- void COval :: Draw(void)
- {
- Rect Location;
-
- Location = this->Location;
- FrameOval(&Location);
- }
-
- void COval :: Erase(void)
- {
- Rect Location;
-
- Location = this->Location;
- EraseOval(&Location);
- }
-
- void CRectangle :: Draw(void)
- {
- Rect Location;
-
- Location = this->Location;
- FrameRect(&Location);
- }
-
- void CRectangle :: Erase(void)
- {
- Rect Location;
-
- Location = this->Location;
- EraseRect(&Location);
- }
-
- void CLine :: Draw(void)
- {
- MoveTo(Location.left,Location.top);
- LineTo(Location.right,Location.bottom);
- }
-
- void CLine :: Erase(void)
- {
- int oldPenMode;
-
- oldPenMode = thePort->pnMode;
- PenMode(notPatCopy);
- MoveTo(Location.left,Location.top);
- LineTo(Location.right,Location.bottom);
- PenMode(oldPenMode);
- }